Skip to content

fix(@schematics/angular): add a TODO for negated arrayWithExactContents in refactor-jasmine-vitest - #34691

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
MeAkib:fix/jasmine-vitest-negated-array-exact-contents
Nov 16, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
MeAkib:fix/jasmine-vitest-negated-array-exact-contents

Conversation

@MeAkib

@MeAkib MeAkib commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

transformArrayWithExactContents splits the assertion into a .toHaveLength() check and a .toEqual(expect.arrayContaining()) check without looking for .not. A negated assertion is split into two negated checks, which asserts that neither condition holds instead of not both: an array with the right length but different contents passes in Jasmine and fails after the migration.

Vitest has no single matcher for exact-contents-in-any-order, so a faithful negation cannot be expressed by splitting. Leave the negated form unchanged and add a TODO comment instead, matching the existing handling of a dynamic (non-literal) argument.

…ts in refactor-jasmine-vitest

`transformArrayWithExactContents` splits the assertion into a
`.toHaveLength()` check and a `.toEqual(expect.arrayContaining())`
check without looking for `.not`. A negated assertion is split into two
negated checks, which asserts that neither condition holds instead of
not both: an array with the right length but different contents passes
in Jasmine and fails after the migration.

Vitest has no single matcher for exact-contents-in-any-order, so a
faithful negation cannot be expressed by splitting. Leave the negated
form unchanged and add a TODO comment instead, matching the existing
handling of a dynamic (non-literal) argument.

The new spec runs the full transform pipeline on a negated assertion;
it fails without this change and `//packages/schematics/angular:test`
passes with it.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds handling for negated jasmine.arrayWithExactContents assertions during the Jasmine-to-Vitest migration. It prevents incorrect splitting of negated assertions by adding a TODO comment for manual migration instead. A test case and the corresponding TODO message definition have also been added. I have no feedback to provide as the implementation is clean and correct.

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Nov 16, 2026
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Nov 16, 2026
@alan-agius4
alan-agius4 merged commit 4cb7bb5 into angular:main Nov 16, 2026
42 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

@MeAkib
MeAkib deleted the fix/jasmine-vitest-negated-array-exact-contents branch November 16, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants